﻿using System;
using System.Reflection;
using Rainbow.ObjectFlow.Interfaces;

namespace Objectflow.core.tests.TestOperations
{
    public enum OperationType
    {
        DoubleSpace, Colour
    }

    public class TestFactory
    {
        public class OperationFactory
        {
            public IOperation<Colour> CreateOperation(OperationType operation)
            {
                Assembly executingAssembly = Assembly.GetExecutingAssembly();
                string assemblyName = executingAssembly.GetName().Name;
                var ob = Activator.CreateInstance(null, "Objectflow.core.tests.TestOperations." + operation);
                //var ob = Activator.CreateInstance(Type.GetType("Objectflow.core.tests.TestOperations." + operation));
                return ob.Unwrap() as IOperation<Colour>;
            }
        }

        public static OperationFactory CreateOperationFactory()
        {
            return new OperationFactory();
        }
    }
}